# Maintainer: ungleich <alpinelinux@ungleich.ch>
pkgname=blackbox_exporter
pkgver=0.19.0
pkgrel=5
pkgdesc="Prometheus Blackbox Exporter"
url="https://github.com/prometheus/blackbox_exporter"
license="Apache-2.0"
arch="all"
install="$pkgname.pre-install"
makedepends="go"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/prometheus/blackbox_exporter/archive/v$pkgver.tar.gz
	blackbox_exporter.confd
	blackbox_exporter.initd
	blackbox.yml
"
subpackages="$pkgname-openrc"

# secfixes:
#   0.18.0-r0:
#     - CVE-2020-16248

build() {
	go build
}

check() {
	go test
}

package() {
	# dirs
	install -dm755 "$pkgdir"/etc/blackbox_exporter

	# init
	install -Dm755 blackbox_exporter \
		"$pkgdir"/usr/bin/blackbox_exporter
	install -Dm755 "$srcdir"/blackbox_exporter.initd \
		"$pkgdir"/etc/init.d/blackbox_exporter
	install -Dm644 "$srcdir"/blackbox_exporter.confd \
		"$pkgdir"/etc/conf.d/blackbox_exporter

	# config
	install -Dm644 blackbox.yml \
		"$pkgdir"/etc/blackbox_exporter/blackbox.yml
}
sha512sums="86b11bc7afa0d8261d0961ca21563047b1ea8bfd1a9d4d034c393a8b098b035147883a44011cdafca8e9795a5e9a043cc15235375990f3424137af63469a8878  blackbox_exporter-0.19.0.tar.gz
e850f8414af33333619946d9163169411a8b5c27dc3611cc27a0c3185748feab3fa31a02ba00d421be9ea16fd2eb2d6395b1438b6d0b0f088eecf93010866d9b  blackbox_exporter.confd
6301661eb0b0bc4e137a268e703959d907bfa6220e3520a60f6c9662335033fdaf477add8e1a0fbc9593580e90fe6ec86fe340c7cbe6c082ec65eb70d883867a  blackbox_exporter.initd
60e9e8d44f807fcb71b01c29abac8cc833e43b7991185624414d049e05f484f8f8026f0290ce8f84a594f5f6363bcd4ef986de20b221f4b0e828ca811deb6e7f  blackbox.yml"
